//
//  ThirdLoginItemView.swift
//  maopu
//
//  Created by huazi on 2017/5/1.
//  Copyright © 2017年 maopu. All rights reserved.
//

import UIKit

class ThirdLoginItemView: UIView {
    fileprivate var btnLogin: UIButton!
    fileprivate var labelLogin: UILabel!
    public var btnLoginClickClosure: ((_ btnLogin: UIButton) -> ())?
    /*
    // Only override draw() if you perform custom drawing.
    // An empty implementation adversely affects performance during animation.
    override func draw(_ rect: CGRect) {
        // Drawing code
    }
    */
    init(title:String, imageName:String, frame: CGRect){
        super.init(frame: frame)
        self.initView(title: title, imageName: imageName)
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    func initView(title:String, imageName:String) {
        self.btnLogin = UIButton.init(frame: CGRect.init(x: 0, y: 0, width: 60, height: 60))
        self.btnLogin.setBackgroundImage(UIImage.init(named: imageName), for: .normal)
        self.btnLogin.addTarget(self, action: #selector(btnLoginClick), for: .touchUpInside)
        self.addSubview(self.btnLogin)
        
        self.labelLogin = UILabel.init(frame: CGRect.init(x: 0, y: 60, width: 60, height: 30))
        self.labelLogin.textAlignment = .center
        self.labelLogin.text = title
        self.labelLogin.textColor = UIColor.m_textLightColor()
        self.labelLogin.font = UIFont.LightDefaultFont(13)
        self.addSubview(self.labelLogin)
    }
    func btnLoginClick() {
        self.btnLoginClickClosure!(self.btnLogin)
    }
}
